<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
      <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta content="" name="description" />
    <meta content="webthemez" name="author" />
    <meta http-equiv="pragram" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">

    <title>Bootstrap Admin Template</title>
	<!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet" />
     <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet" />
    <link href="assets/css/select2.min.css" rel="stylesheet" >
    <link href="assets/css/checkbox3.min.css" rel="stylesheet" >
        <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet" />
     <!-- Google Fonts-->
   <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
</head>
<body>
<div id="page-wrapper">

    <div class="header">
        <h1 class="page-header">
            审核资料
        </h1>

    </div>

        
            <div id="page-inner"> 
               
            <div class="row">
                <div class="col-md-12">
                    <!-- Advanced Tables -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                             学生列表
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline" role="grid">
                                    <table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables" aria-describedby="dataTables-example_info">

                                    <thead>
                                        <tr role="row">
                                        <th class="sorting_asc" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column ascending" style="width: 79.6667px;">序号</th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" style="width: 121.667px;">学生名</th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 112.667px;">学号</th>
                                            <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 112.667px;">课题</th>
                                            <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 112.667px;">下载</th>
                                        <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending" style="width: 65.6667px;">审核论文</th>

                                        </tr>
                                    </thead>
                                    <tbody id="data">


                                        </tbody>
                                </table>
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
                                                    <div id="pageGro" >
                                                        <div id="pagelist">
                                                            <ul class="pagination"></ul>
                                                        </div>
                                                    </div>
                                            </div>
                                        </div>
                                    </div>

                        </div>
                    </div>
                    <!--End Advanced Tables -->
                </div>
            </div>

        </div>
    </div>

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
            <h4 class="modal-title" id="myModalLabel">审核</h4>
            </div>
    <div class="modal-body">
    <div class="form-group">
        <label>成绩：</label>
        <input type="search" id="comment" class="form-control input-sm" aria-controls="dataTables-example">
    </div>
 </div>
 <div class="modal-footer">
  <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
  <button type="button" id="btn_pass" class="btn btn-primary" data-dismiss="modal" onclick="pass()"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>通过</button>
     <button type="button" id="btn_depass" class="btn btn-primary" data-dismiss="modal" onclick="depass()"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>撤销通过</button>
  <!--<button type="button" id="btn_submit" class="btn btn-primary" data-dismiss="modal"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>撤销申请</button>-->
 </div>
 </div>
 </div>
 </div>

                <div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                                <h4 class="modal-title" id="myModalLabel3">审核</h4>
                            </div>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label>学生：</label>
                                    <span id="studName3">d</span>
                                </div>
                                <div class="form-group">
                                    <label>简介：</label>
                                    <span id="summary3"></span>
                                </div>
                                <div class="form-group">
                                    <label>评语：</label>
                                    <input type="search" id="comment3" class="form-control input-sm" aria-controls="dataTables-example">
                                </div>
                                <div class="form-group">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            历史文档
                                        </div>
                                        <div class="panel-body">
                                            <div class="table-responsive">
                                                <table class="table table-hover">
                                                    <thead>
                                                    <tr>
                                                        <th>#</th>
                                                        <th>文档</th>
                                                        <th>操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="download3">
                                                    <tr>
                                                        <td>1</td>
                                                        <td>Mark</td>
                                                        <td></td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
                                <button type="button" id="btn_pass3" class="btn btn-primary" data-dismiss="modal" onclick="pass3()"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>通过</button>
                                <button type="button" id="btn_depass3" class="btn btn-primary" data-dismiss="modal" onclick="depass3()"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>撤销通过</button>
                                <!--<button type="button" id="btn_submit" class="btn btn-primary" data-dismiss="modal"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>撤销申请</button>-->
                            </div>
                        </div>
                    </div>
                </div>

                <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                                <h4 class="modal-title" id="myModalLabel2">审核</h4>
                            </div>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label>学生：</label>
                                    <span id="studName2">d</span>
                                </div>
                                <div class="form-group">
                                    <label>简介：</label>
                                    <span id="summary2"></span>
                                </div>
                                <div class="form-group">
                                    <label>评语：</label>
                                    <input type="search" id="comment2" class="form-control input-sm" aria-controls="dataTables-example">
                                </div>
                                <div class="form-group">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            历史文档
                                        </div>
                                        <div class="panel-body">
                                            <div class="table-responsive">
                                                <table class="table table-hover">
                                                    <thead>
                                                    <tr>
                                                        <th>#</th>
                                                        <th>文档</th>
                                                        <th>操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="download2">
                                                    <tr>
                                                        <td>1</td>
                                                        <td>Mark</td>
                                                        <td></td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
                                <button type="button" id="btn_pass2" class="btn btn-primary" data-dismiss="modal" onclick="pass2()"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>通过</button>
                                <button type="button" id="btn_depass2" class="btn btn-primary" data-dismiss="modal" onclick="depass2()"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>撤销通过</button>
                                <!--<button type="button" id="btn_submit" class="btn btn-primary" data-dismiss="modal"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>撤销申请</button>-->
                            </div>
                        </div>
                    </div>
                </div>


                <div class="modal fade" id="myModal0" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                                <h4 class="modal-title" id="myModalLabel0">审核</h4>
                            </div>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label>学生：</label>
                                    <span id="studName0">d</span>
                                    <input type="hidden" id="username">
                                </div>
                                <div class="form-group">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            历史文档
                                        </div>
                                        <div class="panel-body">
                                            <div class="table-responsive">
                                                <table class="table table-hover">
                                                    <thead>
                                                    <tr>
                                                        <th>#</th>
                                                        <th>文档</th>
                                                        <th>操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="download0">
                                                    <tr>
                                                        <td>1</td>
                                                        <td>Mark</td>
                                                        <td></td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
                                <button type="button" id="btn_pass0" class="btn btn-primary" data-dismiss="modal" onclick="pass3()"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>通过</button>
                                <button type="button" id="btn_depass0" class="btn btn-primary" data-dismiss="modal" onclick="depass3()"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>撤销通过</button>
                                <!--<button type="button" id="btn_submit" class="btn btn-primary" data-dismiss="modal"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>撤销申请</button>-->
                            </div>
                        </div>
                    </div>
                </div>

            </div>
</div>
<!--<script type="text/javascript">-->
<!--function showdialog(){-->
    <!--$('#myModal').modal();-->
<!--}-->
<!--</script>-->
     <!-- /. WRAPPER  -->
    <!-- JS Scripts-->
    <!-- jQuery Js -->
<script src="assets/js/jquery-1.10.2.js"></script>
      <!-- Bootstrap Js -->
<script src="assets/js/bootstrap.min.js"></script>
    <!-- Metis Menu Js -->
<script src="assets/js/jquery.metisMenu.js"></script>
      <!-- Custom Js -->

    <!--ajax-->
<script src="assets/js/jQuery-2.1.4.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/pageGroup.js"></script>
<script>
    var tsid='';
    var revid='';
    var tlid='';
    var ppid='';

    Date.prototype.Format = function (fmt) { //author: meizz
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "h+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }


    function parseTp(id) {
        return getResponse('/topic/findById/'+id).responseJSON.topicName;
    }
    var user= JSON.parse(sessionStorage.getItem("user"));
    var pageNum=0;
    show(pageNum);
    function show(pageNum) {
        var tablere=getResponse('/user/findByAddStateIn/THESIS_PENDING/10/0');
        console.log(tablere);
        var tmp="";
        for(var i=0;i<tablere.responseJSON.content.length;i++){
            var temp=tablere.responseJSON.content[i];
                tmp+='<tr class="gradeA odd">';
                tmp+='<td class="sorting_1">'+i+'</td>'
                    +'<td class="center">'+temp.realname+'</td>'
                    +'<td class="center">'+temp.username+'</td>'
                    +'<td class="center">'+parseTp(temp.topicId)+'</td>'
                    +'<td class="center">'+"<a href='http://localhost:8080/user/downFile/"+temp.additionalData.thesisFile+"'  class='list-group-item'>下载</a>"+'</td>'
//                    +'<td class="center"><a href="#" class="btn btn-success" onclick="showdialog(\''+(tablere.responseJSON[i].additionalData==null?null:tablere.responseJSON[i].additionalData.taskId)+'\')" data-toggle="modal" data-target="#myModal0">审核</a></td>'
                    +'<td class="center"><a href="#" class="btn btn-success" onclick="showdialog1(\''+temp.id+'\')" data-toggle="modal" data-target="#myModal">审核</a></td>'
                    +'</tr>';
        }
        document.getElementById("data").innerHTML=tmp;
    }

</script>
<script>

    var tempId="";
    function showdialog(sid) {
        var tmp='';
        var re=getResponse("/assignment/find/"+topicId);
        console.log(re);
        document.getElementById("studName0").innerHTML=realname;
        document.getElementById("username").value=username;
        for(var i=0;i<re.responseJSON.stuList.length;i++){
            if(i%2==0){
                if(re.responseJSON.stuList[i].realname==realname) {
                    tmp += '<tr class="gradeA odd">';
                    tmp += '<td class="sorting_1">' + i + '</td>'
                        + '<td class="sorting_1">' + new Date(re.responseJSON.stuList[i].createtime).Format("yyyy-MM-dd hh:mm:ss") + '</td>'
                        + '<td class="center"><a href="' + "http://localhost:8080/user/downFile/" + re.responseJSON.stuList[i].wordId + '" download>下载</a></td>'
                        + '</tr>';
                }
            }
            else{
                if(re.responseJSON.stuList[i].realname==realname) {
                    tmp += '<tr class="gradeA even">';
                    tmp += '<td class="sorting_1">' + i + '</td>'
                        + '<td class="sorting_1">' + new Date(re.responseJSON.stuList[i].createtime).Format("yyyy-MM-dd hh:mm:ss") + '</td>'
                        + '<td class="center"><a href="' + "http://localhost:8080/user/downFile/" +re.responseJSON.stuList[i].wordId + '" download>下载</a></td>'
                        + '</tr>';
                }
            }
        }
        document.getElementById("download0").innerHTML=tmp;

    }


    function showdialog1(id) {
        tempId=id;
        document.getElementById("comment").value='';
        if(id==null)
            return;
        var flag=false;
//        var re=getResponse("/review/findById/"+id);
//        document.getElementById("comment").value=re.responseJSON.comment;
    }

    function showdialog2(id) {
        tlid='';
        document.getElementById("summary2").innerHTML='';
        document.getElementById("studName2").innerHTML='';
        document.getElementById("comment2").value='';
        document.getElementById("download2").innerHTML='';
        if(id==null)
            return;
        var flag=false;
        var re=getResponse("/translation/findById/"+id);
        tlid=id;
        document.getElementById("summary2").innerHTML=re.responseJSON.summary;
        document.getElementById("studName2").innerHTML=re.responseJSON.stuName;
        document.getElementById("comment2").value=re.responseJSON.comment==null?null:re.responseJSON.comment;
        var revFile=re.responseJSON.transFile;
        var tmp='';
        for(var i=0;i<revFile.length;i++){
            if(i%2==0){
                tmp+='<tr class="gradeA odd">';
                tmp+='<td class="sorting_1">'+i+'</td>'
                    +'<td class="sorting_1">'+new Date(revFile[i].uploadTime).Format("yyyy-MM-dd hh:mm:ss")+'</td>'
                    +'<td class="center"><a href="'+"http://localhost:8080/user/downFile/"+revFile[i].reviewDoc+'" download>下载</a></td>'
                    +'</tr>';
            }
            else{
                tmp+='<tr class="gradeA even">';
                tmp+='<td class="sorting_1">'+i+'</td>'
                    +'<td class="sorting_1">'+new Date(revFile[i].uploadTime).Format("yyyy-MM-dd hh:mm:ss")+'</td>'
                    +'<td class="center"><a href="'+"http://localhost:8080/user/downFile/"+revFile[i].reviewDoc+'" download>下载</a></td>'
                    +'</tr>';
            }
        }
        document.getElementById("download2").innerHTML=tmp;

    }

    function showdialog3(id) {
        console.log('asdsada');
        console.log(id);
        ppid='';
        document.getElementById("summary3").innerHTML='';
        document.getElementById("studName3").innerHTML='';
        document.getElementById("comment3").value='';
        document.getElementById("download3").innerHTML='';
        if(id==null)
            return;
        console.log(12312)
        var flag=false;
        var re=getResponse("/proposal/findById/"+id);
        ppid=id;
        document.getElementById("summary3").innerHTML=re.responseJSON.summary;
        document.getElementById("studName3").innerHTML=re.responseJSON.stuName;
        document.getElementById("comment3").value=re.responseJSON.comment;
        var revFile=re.responseJSON.prosalFile;
        var tmp='';
        for(var i=0;i<revFile.length;i++){
            if(i%2==0){
                tmp+='<tr class="gradeA odd">';
                tmp+='<td class="sorting_1">'+i+'</td>'
                    +'<td class="sorting_1">'+new Date(revFile[i].uploadTime).Format("yyyy-MM-dd hh:mm:ss")+'</td>'
                    +'<td class="center"><a href="'+"http://localhost:8080/user/downFile/"+revFile[i].reviewDoc+'" download>下载</a></td>'
                    +'</tr>';
            }
            else{
                tmp+='<tr class="gradeA even">';
                tmp+='<td class="sorting_1">'+i+'</td>'
                    +'<td class="sorting_1">'+new Date(revFile[i].uploadTime).Format("yyyy-MM-dd hh:mm:ss")+'</td>'
                    +'<td class="center"><a href="'+"http://localhost:8080/user/downFile/"+revFile[i].reviewDoc+'" download>下载</a></td>'
                    +'</tr>';
            }
        }
        document.getElementById("download3").innerHTML=tmp;

    }

    function apply() {
        var user= JSON.parse(sessionStorage.getItem("user"));//将json转换为对象
        var id=user.id;
        var reUser=getResponse('/user/findUser/'+id);
        if (reUser.responseJSON.topicId == null||reUser.responseJSON.topicId=="") {
            var re=getResponse('/topic/applyTopic/'+topicid+'/'+id);
            alert("选题成功！");
            show(0);
        }else{
            alert("你已选题！");
        }

    }

    function pass() {
        var rid=tempId;
        var com=document.getElementById("comment").value;
        var res=getResponse('/user/auditThesis/'+rid+'?grade='+com+'&isPass=true');
    }

    function depass() {
        var rid=tempId;
        var com=document.getElementById("comment").value;
        var res=getResponse('/user/auditThesis/'+rid+'?grade='+com+'&isPass=false');
    }
    function pass2() {
        var tid=tlid;
        var com=document.getElementById("comment2").value;
        var res=getResponse('/translation/passTranslation/'+tlid+'?comment='+com);
    }

    function depass2() {
        var tid=tlid;
        var com=document.getElementById("comment2").value;
        var res=getResponse('/translation/depassTranslation/'+tlid+'?comment='+com);
    }

    function pass3() {
       var username=document.getElementById("username").value;
        var res=getResponse('/assignment/passAssignment/'+username);
    }

    function depass3() {
        var username=document.getElementById("username").value;
        var res=getResponse('/assignment/depassAssignment/'+username);
    }

</script>
</body>
</html>
